﻿<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
	<title>layui在线调试</title>
	<link rel="stylesheet" th:href="@{/webjars/layui/2.5.4/css/layui.css}" href="//res.layui.com/layui/dist/css/layui.css?t=1568076536509" media="all">
	<link rel="stylesheet" type="text/css" th:href="@{/css2/H-ui.admin.css}" />
	<link rel="stylesheet" type="text/css" th:href="@{/css2/H-ui.min.css}" />
	<link rel="stylesheet" type="text/css" th:href="@{/css2/iconfont.css}" />
	<link rel="stylesheet" type="text/css" th:href="@{/css2/skin.css}" id="skin" />
	<link rel="stylesheet" type="text/css" th:href="@{/css2/jquery.contextMenu.css}" />
	<link rel="stylesheet" type="text/css" th:href="@{/css2/style.css}"/>


	<link rel="Bookmark" href="/favicon.ico" >
	<link rel="Shortcut Icon" href="/favicon.ico" />
	<!--[if lt IE 9]>
	<script type="text/javascript" src="lib/html5shiv.js"></script>
	<script type="text/javascript" src="lib/respond.min.js"></script>
	<![endif]-->
	<link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css" />
	<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css" />
	<link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css" />
	<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css" />
	<!--[if IE 6]>-->
    <script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    </head>
    <body>
    <div class="page-container">
        <div class="mt-20">
            <table id = "tbo" class="table table-border table-bordered table-hover table-bg table-sort">
                <thead>
                <h2><a class="btn btn-sm btn-success" href="AddRent">添加资讯</a></h2>
                <tr class="text-c">
                    <th width="100">ID</th>
                    <th width="100">标题</th>
                    <th width="100">类别</th>
                    <th width="100">来源</th>
                    <th width="100">关键字</th>
                    <th width="100">时间</th>
                    <th width="100">状态</th>
                    <th width="100">操作</th>
                </tr>
                </thead>
                <tbody>
                <tr class="text-c" th:each="hh:${list}">
                    <th width="100" th:text="${hh.rent_id}"></th>
                    <th width="100" th:text="${hh.rent_article_title}"></th>
                    <th width="100" th:text="${hh.itemCategory.item_name}"></th>
                    <th width="100" th:text="${hh.rent_source}"></th>
                    <th width="100" th:text="${hh.rent_antistop}"></th>
                    <th width="100" th:text="${#dates.format(hh.rent_date,'yyyy-MM-dd')}"></th>
                    <th width="100" id="ztai" class="td-status" th:switch="${hh.consultState.state_name}">
                        <span th:case="已发布" class="label label-success radius"th:text="${hh.consultState.state_name}">已发布</span>
                        <span th:case="未发布" class="label label-danger radius"th:text="${hh.consultState.state_name}">未发布</span>
                    </th>
                    <th width="100">
                        <a th:switch="${hh.consultState.state_name}" th:id="${hh.rent_id}" >
                            <a th:case="已发布" th:onclick="|UpdateCx(this,${hh.rent_id})|" title="撤销">✂</a>
                            <a th:case="未发布" th:onclick="|UpdateFb(this,${hh.rent_id})|" title="发布">✎</i></a>
                        </a>
                        <a href="javascript:;" th:id="${hh.rent_id}" title="详细" onclick="shouhuoren(this)">✉</a>
                    </th>
                </tr>
                </tbody>

            </table>
        </div>
    </div>
    </body>
    <script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
    <script type="text/javascript" src="static/h-ui/js/H-ui.min.js"></script>
    <script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script>
    <script th:src="@{/webjars/jquery/2.1.1/jquery.js}"></script>
    <script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
    <script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script>
    <script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
    <script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
    <script th:src="@{/js2/jquery.dataTables.min.js}"></script>
    <script>
        $(document).ready(function(){
            $(function(){
                $('#tbo').DataTable({
                    "aLengthMenu":[4,8],
                    "aaSorting": [
                        [ 1, "desc" ]
                    ]//默认第几个排序
                });
            });
        });

        //=====弹出窗设置
        function DelTipWidth(Twidth,Theight){
            $(".tip_box",Wparent).css({"width":Twidth+"px","height":Theight+"px","margin-top":-(Theight/2)+"px","margin-left":-(Twidth/2)+"px"});
            $(".tip_close",Wparent).on("click",Tipclose);
        }
        //=====关闭弹出窗
        function Tipclose(){
            $(".tip_box",Wparent).remove(); //移除新增的外层className
            $(".tip_bg",Wparent).remove(); //移除新增的背景className
            /*window.location.reload();*/
        }


        var Wparent = window.document;
        var Bg = "<div class='tip_bg tipbg_top'></div>",
                Box = "<div class='tip_box tipbox_top'></div>";
        //资讯详情
        function shouhuoren(obj){
            $("body",Wparent).append(Bg);
            $("body",Wparent).append(Box);
            var checkId = $(obj).attr("id");
            $(".tip_box",Wparent).prepend("<h2>资讯详情<span class='tip_close'><i class='fa fa-close'>关闭</i></span></h2><div class='tip_tbox'></div>");
            $(".tip_tbox",Wparent).append("<iframe src='SelIdRent?rentid="+checkId+"' frameborder='0' width='100%' height='100%' seamless></iframe>");
            DelTipWidth(1000,470);
        }
        /*撤销*/
        function UpdateCx(obj,id){
			layer.confirm('确认要撤销吗？',function(index){
				//此处请求后台程序，下方是成功后的前台处理……
				location.href="UpCX?rent_id="+id;
			});
        }

        /*发布*/
        function UpdateFb(obj,id){
            layer.confirm('确认要发布吗？',function(index){
                //此处请求后台程序，下方是成功后的前台处理……
                location.href="UpFB?rent_id="+id;
            });
        }
    </script>
    </html>